

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title><g:message code="student.create" default="Create Student" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir:'')}"><g:message code="home" default="Home" /></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="student.list" default="Student List" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="student.create" default="Create Student" /></h1>
            <g:if test="${flash.message}">
            <div class="message"><g:message code="${flash.message}" args="${flash.args}" default="${flash.defaultMessage}" /></div>
            </g:if>
            <g:hasErrors bean="${student}">
            <div class="errors">
                <g:renderErrors bean="${student}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" method="post" >
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="number"><g:message code="student.number" default="Number" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:student,field:'number','errors')}">
                                    <input type="text" id="number" name="number" value="${fieldValue(bean:student,field:'number')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="name"><g:message code="student.name" default="Name" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:student,field:'name','errors')}">
                                    <input type="text" id="name" name="name" value="${fieldValue(bean:student,field:'name')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="address"><g:message code="student.address" default="Address" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:student,field:'address','errors')}">
                                    <input type="text" id="address" name="address" value="${fieldValue(bean:student,field:'address')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="bloodType"><g:message code="student.bloodType" default="Blood Type" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:student,field:'bloodType','errors')}">
                                    <g:select id="bloodType" name="bloodType" from="${student.constraints.bloodType.inList}" value="${student.bloodType}" valueMessagePrefix="student.bloodType" ></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="teachers"><g:message code="student.teachers" default="Teachers" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:student,field:'teachers','errors')}">
                                    <g:select optionKey="id" from="${Teacher.list()}" name="teachers\$.id" value="${student?.teachers?.id ?: []}" musize="5"></g:select>
                                </td>
                            </tr> 
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="${message(code:'create', 'default':'Create')}" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
